package com.itcoon.transform.assemble.handler.clazz;

import com.itcoon.transform.base.TransformHandlerComposite;
import com.itcoon.transform.base.constants.ComponentOrderConstants;
import com.itcoon.transform.base.definition.InjectDefinition;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class TargetReferenceHandler implements AssembleForTargetClassHandler {

    @Autowired
    private TransformHandlerComposite composite;

    @Override
    public boolean support(Class<?> targetPropertyType, Object originGetterValue, List<InjectDefinition.InjectInfo> injectInfos) {
        return true;
    }

    @Override
    public Object handle(Class<?> targetPropertyType, Object originGetterValue, List<InjectDefinition.InjectInfo> injectInfos) {
        return composite.handle(targetPropertyType, originGetterValue, injectInfos);
    }

    @Override
    public int getOrder() {
        return ComponentOrderConstants.ASSEMBLE_HANDLER_MAX;
    }
}
